package com.mc.music_web.controller;

import com.mc.music_web.entity.Ticket;
import com.mc.music_web.services.TicketService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TicketController {
    @Autowired
    private TicketService ticketService;
       @RequestMapping("/ticket")
     public String LastTicket(){
            return  "/admin/ticket";
       }

       @RequestMapping("admin/toTicket")
      @ResponseBody
       public List ticketList(){
           List<Ticket> list=ticketService.sellectTicket();
           return list;
       }
    @RequestMapping("/admin/ticDel")
    @ResponseBody
    public int ticketDel(Integer ticketId) {
        int result = ticketService.delterTicket(ticketId);

        return result;
    }

    @RequestMapping("/admin/adminByTicket")
    @ResponseBody
    public  List  selectBySinger(String keyword){
        List<Ticket> list=ticketService.selectByChooseTicket(keyword);
        return list;
    }





    @RequestMapping("/admin/doTicketUpdate")
    @ResponseBody
    public Ticket doUpdateTicket(Ticket ticket) {

        ticketService.updateTicket(ticket);
        return ticket;
    }


 /*   @RequestMapping("/admin/goSongLimit")
    @ResponseBody
    public PageInfo selectSongLimit(int pageNum, HttpSession session) {
        PageInfo<Song> pageInfosO = songVoService.selectSongLimit(pageNum);
        session.setAttribute("songSession",pageInfosO);
        return pageInfosO;
    }*/






    @RequestMapping("/admin/addTicket")
    @ResponseBody
    public Integer addTicket(Ticket ticket){

        Integer i = ticketService.insertTicket(ticket);
        return i;
    }
}
